import axios from 'axios';
import { React, useEffect, useState } from 'react';
import '../../../index.css';
import { Pagination } from 'antd';
import InterIP from '../../../IP/IP'
export default function Gone() {

    const [allMainData, setMainData] = useState([]);

    useEffect(() => {
        var userID = document.cookie.slice(5);
        let IP = InterIP().props.children;
        axios.post("http://" + IP + ":3000/user/selOrder", {
            user_id: userID,
        })
            .then((res) => {
                setMainData((allMainData) => allMainData = res.data)
            })

    }, []);


    return (
        <div>
            {allMainData.map((data) => {
                return (
                    <div className="allorder_card" key={data.order_id}>
                        <div className="allorder_card_top">
                            <ul>
                                <li>订单号:<span>{data.order_id}</span></li>
                                <li>下单日期:<span>{data.order_time}</span></li>
                                <li>{data.stroe_id}</li>
                                <li>订单状态:<span>{data.order_status}</span></li>
                            </ul>
                        </div>
                        <div className="allorder_bottom">
                            <div className="allorder_card_main">
                                <div className="allorder_card_main_left">
                                    <div className="allorder_card_left">
                                        <div className="allorder_card_img">
                                            <img src={data.product_img} alt=""></img>
                                        </div>
                                        <span>{data.product_id}</span>
                                    </div>

                                    <div className="allorder_card_left">
                                        <span>6</span>个装
                                    </div>

                                    <div className="allorder_card_left">
                                        <span>￥</span>
                                        <span>12412</span>
                                        <span>&nbsp;&nbsp;*&nbsp;&nbsp;</span>
                                        <span>{data.buy_number}</span>
                                    </div>
                                </div>

                            </div>
                            <div className="lfy_small">
                                <div className="allorder_card_right1">
                                    <div>店铺合计：￥<span>{data.total_price}</span></div>
                                    <div>(含运费:￥<span>{data.freight}</span>)</div>
                                </div>
                                <div className="allorder_card_right2">
                                    <button>查看详情</button>
                                    <button>删除订单</button>
                                </div>
                            </div>
                        </div>
                    </div>
                )
            })}
            <Pagination className="allorder_page" total={30} pageSize={6}></Pagination>
        </div>
    )
}
